home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / gcc / i486-linux-gnu / 4.3 / include-fixed / linux / a.out.h
Encoding:
C/C++ Source or Header  |  2009-03-16  |  7.4 KB  |  280 lines

  1. /*  DO NOT EDIT THIS FILE.
  2.  
  3.     It has been auto-edited by fixincludes from:
  4.  
  5.     "/usr/include/linux/a.out.h"
  6.  
  7.     This had to be done to correct non-standard usages in the
  8.     original, manufacturer supplied header file.  */
  9.  
  10. #ifndef __A_OUT_GNU_H__
  11. #define __A_OUT_GNU_H__
  12.  
  13. #define __GNU_EXEC_MACROS__
  14.  
  15. #ifndef __STRUCT_EXEC_OVERRIDE__
  16.  
  17. #include <asm/a.out.h>
  18.  
  19. #endif /* __STRUCT_EXEC_OVERRIDE__ */
  20.  
  21. #ifndef __ASSEMBLY__
  22.  
  23. /* these go in the N_MACHTYPE field */
  24. enum machine_type {
  25. #if defined (M_OLDSUN2)
  26.   M__OLDSUN2 = M_OLDSUN2,
  27. #else
  28.   M_OLDSUN2 = 0,
  29. #endif
  30. #if defined (M_68010)
  31.   M__68010 = M_68010,
  32. #else
  33.   M_68010 = 1,
  34. #endif
  35. #if defined (M_68020)
  36.   M__68020 = M_68020,
  37. #else
  38.   M_68020 = 2,
  39. #endif
  40. #if defined (M_SPARC)
  41.   M__SPARC = M_SPARC,
  42. #else
  43.   M_SPARC = 3,
  44. #endif
  45.   /* skip a bunch so we don't run into any of sun's numbers */
  46.   M_386 = 100,
  47.   M_MIPS1 = 151,    /* MIPS R3000/R3000 binary */
  48.   M_MIPS2 = 152        /* MIPS R6000/R4000 binary */
  49. };
  50.  
  51. #if !defined (N_MAGIC)
  52. #define N_MAGIC(exec) ((exec).a_info & 0xffff)
  53. #endif
  54. #define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
  55. #define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
  56. #define N_SET_INFO(exec, magic, type, flags) \
  57.     ((exec).a_info = ((magic) & 0xffff) \
  58.      | (((int)(type) & 0xff) << 16) \
  59.      | (((flags) & 0xff) << 24))
  60. #define N_SET_MAGIC(exec, magic) \
  61.     ((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
  62.  
  63. #define N_SET_MACHTYPE(exec, machtype) \
  64.     ((exec).a_info = \
  65.      ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
  66.  
  67. #define N_SET_FLAGS(exec, flags) \
  68.     ((exec).a_info = \
  69.      ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
  70.  
  71. /* Code indicating object file or impure executable.  */
  72. #define OMAGIC 0407
  73. /* Code indicating pure executable.  */
  74. #define NMAGIC 0410
  75. /* Code indicating demand-paged executable.  */
  76. #define ZMAGIC 0413
  77. /* This indicates a demand-paged executable with the header in the text. 
  78.    The first page is unmapped to help trap NULL pointer references */
  79. #define QMAGIC 0314
  80.  
  81. /* Code indicating core file.  */
  82. #define CMAGIC 0421
  83.  
  84. #if !defined (N_BADMAG)
  85. #define N_BADMAG(x)      (N_MAGIC(x) != OMAGIC        \
  86.             && N_MAGIC(x) != NMAGIC        \
  87.               && N_MAGIC(x) != ZMAGIC \
  88.                 && N_MAGIC(x) != QMAGIC)
  89. #endif
  90.  
  91. #define _N_HDROFF(x) (1024 - sizeof (struct exec))
  92.  
  93. #if !defined (N_TXTOFF)
  94. #define N_TXTOFF(x) \
  95.  (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \
  96.   (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec)))
  97. #endif
  98.  
  99. #if !defined (N_DATOFF)
  100. #define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
  101. #endif
  102.  
  103. #if !defined (N_TRELOFF)
  104. #define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
  105. #endif
  106.  
  107. #if !defined (N_DRELOFF)
  108. #define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x))
  109. #endif
  110.  
  111. #if !defined (N_SYMOFF)
  112. #define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x))
  113. #endif
  114.  
  115. #if !defined (N_STROFF)
  116. #define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x))
  117. #endif
  118.  
  119. /* Address of text segment in memory after it is loaded.  */
  120. #if !defined (N_TXTADDR)
  121. #define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? PAGE_SIZE : 0)
  122. #endif
  123.  
  124. /* Address of data segment in memory after it is loaded.
  125.    Note that it is up to you to define SEGMENT_SIZE
  126.    on machines not listed here.  */
  127. #if defined(vax) || defined(hp300) || defined(pyr)
  128. #define SEGMENT_SIZE page_size
  129. #endif
  130. #ifdef    sony
  131. #define    SEGMENT_SIZE    0x2000
  132. #endif    /* Sony.  */
  133. #ifdef is68k
  134. #define SEGMENT_SIZE 0x20000
  135. #endif
  136. #if defined(m68k) && defined(PORTAR)
  137. #define PAGE_SIZE 0x400
  138. #define SEGMENT_SIZE PAGE_SIZE
  139. #endif
  140.  
  141. #ifdef __linux__
  142. #include <unistd.h>
  143. #if defined(__i386__) || defined(__mc68000__)
  144. #define SEGMENT_SIZE    1024
  145. #else
  146. #ifndef SEGMENT_SIZE
  147. #define SEGMENT_SIZE   getpagesize()
  148. #endif
  149. #endif
  150. #endif
  151.  
  152. #define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE)
  153.  
  154. #define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
  155.  
  156. #ifndef N_DATADDR
  157. #define N_DATADDR(x) \
  158.     (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \
  159.      : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
  160. #endif
  161.  
  162. /* Address of bss segment in memory after it is loaded.  */
  163. #if !defined (N_BSSADDR)
  164. #define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
  165. #endif
  166.  
  167. #if !defined (N_NLIST_DECLARED)
  168. struct nlist {
  169.   union {
  170.     char *n_name;
  171.     struct nlist *n_next;
  172.     long n_strx;
  173.   } n_un;
  174.   unsigned char n_type;
  175.   char n_other;
  176.   short n_desc;
  177.   unsigned long n_value;
  178. };
  179. #endif /* no N_NLIST_DECLARED.  */
  180.  
  181. #if !defined (N_UNDF)
  182. #define N_UNDF 0
  183. #endif
  184. #if !defined (N_ABS)
  185. #define N_ABS 2
  186. #endif
  187. #if !defined (N_TEXT)
  188. #define N_TEXT 4
  189. #endif
  190. #if !defined (N_DATA)
  191. #define N_DATA 6
  192. #endif
  193. #if !defined (N_BSS)
  194. #define N_BSS 8
  195. #endif
  196. #if !defined (N_FN)
  197. #define N_FN 15
  198. #endif
  199.  
  200. #if !defined (N_EXT)
  201. #define N_EXT 1
  202. #endif
  203. #if !defined (N_TYPE)
  204. #define N_TYPE 036
  205. #endif
  206. #if !defined (N_STAB)
  207. #define N_STAB 0340
  208. #endif
  209.  
  210. /* The following type indicates the definition of a symbol as being
  211.    an indirect reference to another symbol.  The other symbol
  212.    appears as an undefined reference, immediately following this symbol.
  213.  
  214.    Indirection is asymmetrical.  The other symbol's value will be used
  215.    to satisfy requests for the indirect symbol, but not vice versa.
  216.    If the other symbol does not have a definition, libraries will
  217.    be searched to find a definition.  */
  218. #define N_INDR 0xa
  219.  
  220. /* The following symbols refer to set elements.
  221.    All the N_SET[ATDB] symbols with the same name form one set.
  222.    Space is allocated for the set in the text section, and each set
  223.    element's value is stored into one word of the space.
  224.    The first word of the space is the length of the set (number of elements).
  225.  
  226.    The address of the set is made into an N_SETV symbol
  227.    whose name is the same as the name of the set.
  228.    This symbol acts like a N_DATA global symbol
  229.    in that it can satisfy undefined external references.  */
  230.  
  231. /* These appear as input to LD, in a .o file.  */
  232. #define    N_SETA    0x14        /* Absolute set element symbol */
  233. #define    N_SETT    0x16        /* Text set element symbol */
  234. #define    N_SETD    0x18        /* Data set element symbol */
  235. #define    N_SETB    0x1A        /* Bss set element symbol */
  236.  
  237. /* This is output from LD.  */
  238. #define N_SETV    0x1C        /* Pointer to set vector in data area.  */
  239.  
  240. #if !defined (N_RELOCATION_INFO_DECLARED)
  241. /* This structure describes a single relocation to be performed.
  242.    The text-relocation section of the file is a vector of these structures,
  243.    all of which apply to the text section.
  244.    Likewise, the data-relocation section applies to the data section.  */
  245.  
  246. struct relocation_info
  247. {
  248.   /* Address (within segment) to be relocated.  */
  249.   int r_address;
  250.   /* The meaning of r_symbolnum depends on r_extern.  */
  251.   unsigned int r_symbolnum:24;
  252.   /* Nonzero means value is a pc-relative offset
  253.      and it should be relocated for changes in its own address
  254.      as well as for changes in the symbol or section specified.  */
  255.   unsigned int r_pcrel:1;
  256.   /* Length (as exponent of 2) of the field to be relocated.
  257.      Thus, a value of 2 indicates 1<<2 bytes.  */
  258.   unsigned int r_length:2;
  259.   /* 1 => relocate with value of symbol.
  260.           r_symbolnum is the index of the symbol
  261.       in file's the symbol table.
  262.      0 => relocate with the address of a segment.
  263.           r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS
  264.       (the N_EXT bit may be set also, but signifies nothing).  */
  265.   unsigned int r_extern:1;
  266.   /* Four bits that aren't used, but when writing an object file
  267.      it is desirable to clear them.  */
  268. #ifdef NS32K
  269.   unsigned r_bsr:1;
  270.   unsigned r_disp:1;
  271.   unsigned r_pad:2;
  272. #else
  273.   unsigned int r_pad:4;
  274. #endif
  275. };
  276. #endif /* no N_RELOCATION_INFO_DECLARED.  */
  277.  
  278. #endif /*__ASSEMBLY__ */
  279. #endif /* __A_OUT_GNU_H__ */
  280.